package blackberry.util.hotkey;

public class DjDoubleClickSensor{
	
	public static final int DEFAULT_DOUBLECLICK_TIME = 500;
	private int beforeTime;
	
	public boolean isDoubleClick(int realTime, int appointedTime){
		try {
			return (realTime - beforeTime) < appointedTime;
		} finally {
			beforeTime = realTime;
		}
	}
	
	public boolean isDoubleClick(int realTime){
		return isDoubleClick(realTime, DEFAULT_DOUBLECLICK_TIME);
	}
	
	public void resetBeforeTime() {
		beforeTime = 0;
	}
}